"""
RandCompBreakerStrategy.py

Author: Zach Epolito
Date: 9-21-08
"""

from BreakerStrategy import BreakerStrategy
from WaitFrame import WaitFrame
from random import randint
import time

"""represents a random guessing breaker"""
class RandCompBreakerStrategy(BreakerStrategy):

    #Frame for getting Breaker input

    """Constructor."""
    def __init__(self):
        self.frame = None

    """sends a random list of integers through
    a functor
    """
    def strategy(self, contFunctor, GUI, waitTime):
        #Display waiting in GUI
        if self.frame is None:
            self.frame = WaitFrame(GUI.getRootInputView(), contFunctor, width=300, height=100)
        GUI.set_input_view(self.frame)
        self.frame.update()
        self.frame.update()
        # sleep
        time.sleep(waitTime)
        
        #Tells the GUI class that it should no
        #longer be waiting

        #Creates a random game move and
        #send it to the controller
        guess = [randint(0,5), randint(0,5), randint(0,5), randint(0,5)]
        contFunctor(guess)

        

